package com.wanxi.test;

public class DoubleArray {
    public static void main(String[] args) {
        int[] arr1 = {2, 1};
        int[] arr2 = {3, 5, 2};
        int[] arr3 = {8, 6, 567, 86};
        int[][] arr4 = {arr1, arr2, arr3};
        System.out.println(arr4[1][1]);
//        int[][] arr5 = {{1, 2, 3}, {}, {2}};
//        二维数组是对一维数组的再次封装,将相同数据类型的一维数组装入到一个容器就是二维数组
        int sum=0;
        for (int i = 0; i < arr4.length; i++) {
//            arr4[0] = {2, 3};
//            int[] arr = arr4[i];
            for (int j = 0; j < arr4[i].length; j++) {
//                arr4[i][j]=1;
                System.out.print(arr4[i][j] + ", ");
                sum+=arr4[i][j];
            }
            System.out.println("");
        }
        System.out.println(sum);
    }
}
